<?php

/**
 * Created by PhpStorm.
 * User: raymon
 * Date: 17-8-23
 * Time: 下午5:21
 */
class Article extends MY_Controller
{
    public function __construct()
    {
        parent::__construct();
        $this->_add_style_sheet("dataTables", base_url("assets/DataTables/css/dataTables.bootstrap4.min.css"));
        $this->_add_script_file("dataTables", base_url("assets/DataTables/js/jquery.dataTables.min.js"));
        $this->_add_script_file("dataTables Bootstrap", base_url("assets/DataTables/js/dataTables.bootstrap.min.js"));

        $this->load->model('mod/article_model');
        $this->data_common['myurl'] = array(
            'article' => site_url('mod/article/article/view/')
        );
    }

    public function index()
    {
        $data = array();
        $this->_view('mod/article/article.twig', $data, '', 'mod/article');
    }
    public function view($aid){
        $data = array();
        $this->_add_script_file("htmlCode", base_url("assets/js/htmlcode.js"));

        $data['article'] = $this->article_model->get_article($aid);
        $this->_view('mod/article/article.twig', $data, '', 'mod/article');
    }
    public function articleList($cid){
        $data['article']['list'] = $this->article_model->get_articleList($cid);
        $this->_view('mod/article/article_list.twig', $data, '', 'mod/article');

    }
}